<#include "../common/nolayout.ftl"/>
<@html css_=['user/blog.css'] js_=['user/blog.js']>

<body class="childrenBody">
<blockquote class="layui-elem-quote news_search">
    <form class="layui-form" id="listForm" action="${root}/m/blog/list" method="post">
        <input type="hidden" name="number" id="number" value="1"/>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text" value="" id="title" name="title" placeholder="请输入博客标题" class="layui-input search_input">
            </div>

            <div class="layui-inline">
                <label class="">是否审核</label>
                <div class="layui-input-inline">
                    <select name="type" style="color: #1acf74">
                        <option value="">全部</option>
                        <option value="0">已审核</option>
                        <option value="1">待审核</option>
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="">是否开放</label>
                <div class="layui-input-inline">
                    <select name="openup" style="color: #1acf74">
                        <option value="">全部</option>
                        <option value="0">私密</option>
                        <option value="1">开放</option>
                    </select>
                </div>
            </div>
            <a class="layui-btn search_btn" lay-submit lay-filter="queryForm">查询</a>
            <div class="layui-inline">
                <a class="layui-btn layui-btn-normal addBtn">添加博客</a>
            </div>
        </div>

    </form>
</blockquote>
<div class="layui-form roles_list">
    <table class="layui-table">
        <thead>
        <tr>
            <th>博客标题</th>
            <th>阅读数</th>
            <th>收藏数</th>
            <th>点赞数</th>
            <th>状态</th>
            <th>审核状态</th>
            <th>开放状态</th>
            <th>创建时间</th>
            <th>更新时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody id="listDataBody"></tbody>
    </table>
</div>
<div id="page"></div>
</body>

<script type="text/html" id="addRole">
    <form class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">角色名称</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input roleName" name="roleName" maxlength="16" placeholder="请输入角色名称">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">角色编码</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input roleCode" name="roleCode" maxlength="16" placeholder="请输入角色编码">
            </div>
        </div>
    </form>
</script>

<script id="dataListTpl" type="text/html">
    {{#  if(d.list!=null&&d.list.length> 0){ }}
    {{#  layui.each(d.list, function(index, item){ }}
    <tr>
        <td><a href="/blog/{{item.id}}" target="_blank" class="view" data-id="{{item.id}}">{{item.title}}</a></td>
        <td>{{d.map[item.id].readCount||'0'}}</td>
        <td>{{d.map[item.id].collectCount||'0'}}</td>
        <td>{{d.map[item.id].praiseCount||'0'}}</td>
        <td>
            {{# if(item.status== 0){ }}
            下线
            {{#} else if(item.status==1){ }}
            正常
            {{#} else{ }}
            删除
            {{# } }}
        </td>
        <td>
            {{# if(item.type== 0){ }}
            已通过
            {{#} else{ }}
            待审核
            {{# } }}
        </td>
        <td>
            <input type="checkbox" data-id="{{item.id}}" name="show" class="blogFrozen" lay-skin="switch" lay-text="开放|私密" lay-filter="isShow"
                   {{# if(item.openup == 1){ }}checked="checked" {{# } }} />
        </td>
        <td>{{ layui.util.toDateString(item.insertDate, 'yyyy-MM-dd HH:mm:ss') }}</td>
        <td>{{ layui.util.toDateString(item.lastUpdate, 'yyyy-MM-dd HH:mm:ss') }}</td>
        <td>
            <div class="layui-btn-container">
                <a class="layui-btn layui-btn-xs edit" data-id="{{item.id}}">
                    <i class="layui-icon">&#xe642;</i>编辑</a>
                <a class="layui-btn layui-btn-xs layui-btn-danger del" data-id="{{item.id}}">
                    <i class="layui-icon">&#xe640;</i>删除</a>
            </div>
        </td>
    </tr>
    {{#  }); }}
    {{#} else { }}
    <tr>
        <td colspan="9" style="text-align: center">无数据</td>
    <tr/>
    {{# }}}

</script>

</@html>